<?php

namespace app\utils\ui\ele;

use app\utils\ui\UIView;
use app\utils\ui\vue\VueFormItem;
use app\utils\ui\VueView;

/**
 * 树状选择框
 */
class TreeSelect extends VueFormItem implements VueView{

    /**
     * @param string $vmodel 字段
     * @param string $vmodel_value 字段值
     * @param array|Closure $attr
     * @param array $list 只支持select option 类型的对象
     */
    public function __construct($vmodel,$vmodel_value,$attr,$list) 
    {
        $options = [];
        foreach($list as $item){
            if($item instanceof SelectOption){
                $options[]=$item;
            }
        }
        parent::__construct($vmodel,$vmodel_value,$attr,$options,true);
    }
    

    public function render(){
        return parent::base_render('el-tree-select');
    }
    
}